package com.service.impl;

import com.dao.SearchHistoryDao;
import com.dao.impl.SearchHistoryDaoImpl;
import com.pojo.PageBean;
import com.pojo.ProductType;
import com.pojo.SearchHistory;
import com.service.SearchHistoryService;

import java.util.List;

public class SearchHistoryServiceImpl implements SearchHistoryService {
    private SearchHistoryDao dao = new SearchHistoryDaoImpl();

    @Override
    public PageBean<SearchHistory> findAll(int limit, int current) {
        int count = dao.selectCount();
        List<SearchHistory> list = dao.findAll((current - 1) * limit, limit);
        PageBean<SearchHistory> pageBean = new PageBean<>();
        pageBean.setData(list);
        pageBean.setCurrent(current);
        pageBean.setTotal(count);
        return pageBean;
    }
}
